var t = require;
var e = module;
var o = exports;
var _n24,
    i =
        (this && this.__extends) ||
        ((_n24 = function n(t, e) {
            return (_n24 =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) {
                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                    }
                })(t, e);
        }),
        function (t, e) {
            function o() {
                this.constructor = t;
            }
            _n24(t, e), (t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o()));
        }),
    s =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var i,
                s = arguments.length,
                r = s < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if (
                "object" == (typeof Reflect === "undefined" ? "undefined" : typeof Reflect) &&
                "function" == typeof Reflect.decorate
            )
                r = Reflect.decorate(t, e, o, n);
            else
                for (var c = t.length - 1; c >= 0; c--) {
                    (i = t[c]) && (r = (s < 3 ? i(r) : s > 3 ? i(e, o, r) : i(e, o)) || r);
                }
            return s > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("BaseUI"),
    c = t("UIEnum"),
    a = t("UIManager"),
    u = t("SDK"),
    l = cc._decorator,
    d = l.ccclass,
    p = l.property,
    h = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (
                (e.childNode = null),
                (e.shareBtn = null),
                (e.nextBtn = null),
                (e.dyBtn = null),
                (e.continueBtn = null),
                (e.gameBtn = null),
                (e.tuiguangNode = null),
                (e.tipsTitleLabel = null),
                (e.textsNode = null),
                (e.timeLabel = null),
                (e.areaCountLabel = null),
                (e.btnsNode = null),
                (e.textBgNode = null),
                (e.game = null),
                (e.status = 1),
                (e.time = 0.2),
                e
            );
        }
        return (
            i(e, t),
            (e.prototype.onLoad = function () {
                var t = this,
                    e = this;
                u.default.isTT()
                    ? ((this.gameBtn.active = !0), tt.getSystemInfoSync().appName, (this.dyBtn.active = !1))
                    : ((this.gameBtn.active = !1), (this.dyBtn.active = !1)),
                    0 == this.gameBtn.active && 0 == this.dyBtn.active && (this.tuiguangNode.active = !1),
                    this.shareBtn.on(
                        cc.Node.EventType.TOUCH_END,
                        function (t) {
                            u.default.shareRecorder({
                                success: function success() {
                                    (e.shareBtn.active = !1), e.game.sendEvent("successUIShareVideo");
                                },
                                query: ""
                            }),
                                t.stopPropagation();
                        },
                        this
                    ),
                    this.nextBtn.on(
                        cc.Node.EventType.TOUCH_END,
                        function (o) {
                            t.game.backHome(), e.hide(), o.stopPropagation();
                        },
                        this
                    ),
                    this.continueBtn.on(
                        cc.Node.EventType.TOUCH_END,
                        function () {
                            (t.game.gameWaitTime = 0),
                                (t.game.tipsWaitTime = 0),
                                (t.game.lastPopTime = new Date().getTime()),
                                t.game.currentChapter++,
                                t.game.initChapter(),
                                t.game.indexUI.showDiffcutNode(),
                                t.hide();
                        },
                        this
                    );
            }),
            (e.prototype.moreGame = function () {
                this.game.showMoreGame();
            }),
            (e.prototype.follow = function () {
                this.game.jumpToDy();
            }),
            (e.prototype.start = function () {}),
            (e.prototype.hide = function () {
                (this.game._zanting = !1), a.UIMgr.hide(c.default.SuccessUI, !1, !0);
            }),
            (e.prototype.init = function (t) {
                this.game = t;
            }),
            (e.prototype.onShow = function () {
                var t = this;
                (this.node.active = !0),
                    (this.childNode.scale = 0),
                    cc
                        .tween(this.childNode)
                        .to(0.3, {scale: 1})
                        .call(function () {
                            cc.tween(t.textBgNode).to(2, {width: 740}).start(),
                                cc
                                    .tween(t.textsNode)
                                    .to(2, {width: 700})
                                    .call(function () {
                                        cc.tween(t.timeLabel.node)
                                            .to(0.5, {scale: 1})
                                            .call(function () {
                                                cc.tween(t.areaCountLabel.node)
                                                    .to(0.5, {scale: 1})
                                                    .call(function () {
                                                        t.btnsNode.active = !0;
                                                    })
                                                    .start();
                                            })
                                            .start();
                                    })
                                    .start();
                        })
                        .start(),
                    u.default.getRecorderTime() > 5e3 && !u.default.getRecorderState()
                        ? (this.shareBtn.active = !0)
                        : (this.shareBtn.active = !1);
                for (var e = this.game.textsNode.children, o = e.length - 1; o >= 0; o--) {
                    e[o].parent = this.textsNode;
                }
                if (
                    ((this.textBgNode.width = 40),
                    (this.textsNode.width = 40),
                    (this.timeLabel.node.scale = 0),
                    (this.areaCountLabel.node.scale = 0),
                    (this.btnsNode.active = !1),
                    u.default.isWeb())
                ) {
                    var n = (150 * Math.random() + 40) >> 0,
                        i = (60 * Math.random()) >> 0;
                    this.timeLabel.string =
                        n + this.game.getLanguage("label_min") + i + this.game.getLanguage("label_second");
                } else
                    (n = (this.game.gameTime / 60) >> 0),
                        (i = this.game.gameTime % 60 >> 0),
                        (this.timeLabel.string =
                            n + this.game.getLanguage("label_min") + i + this.game.getLanguage("label_second"));
                (this.areaCountLabel.string = this.game.indexUI.myRegionCount + ""),
                    (this.game._zanting = !0),
                    1 == this.game.currentChapter
                        ? ((this.continueBtn.active = !0),
                          (this.tipsTitleLabel.string = this.game.getLanguage("label_shaokao")))
                        : 2 == this.game.currentChapter
                        ? ((this.continueBtn.active = !0),
                          (this.tipsTitleLabel.string = this.game.getLanguage("label_zhuangyuan")))
                        : 3 == this.game.currentChapter &&
                          ((this.continueBtn.active = !1),
                          (this.tipsTitleLabel.string = this.game.getLanguage("label_shangshu"))),
                    3 == this.game.currentChapter
                        ? ((this.textBgNode.height = 280), (this.textsNode.height = 320))
                        : ((this.textBgNode.height = 200), (this.textsNode.height = 180));
            }),
            (e.prototype.onEnable = function () {
                (this.status = 0), u.default.isTT() && u.default.showBanner();
            }),
            (e.prototype.onDisable = function () {
                (this.status = 1), u.default.isTT() && u.default.hideBanner();
            }),
            (e.prototype.update = function () {}),
            s([p(cc.Node)], e.prototype, "childNode", void 0),
            s([p(cc.Node)], e.prototype, "shareBtn", void 0),
            s([p(cc.Node)], e.prototype, "nextBtn", void 0),
            s([p(cc.Node)], e.prototype, "dyBtn", void 0),
            s([p(cc.Node)], e.prototype, "continueBtn", void 0),
            s([p(cc.Node)], e.prototype, "gameBtn", void 0),
            s([p(cc.Node)], e.prototype, "tuiguangNode", void 0),
            s([p(cc.Label)], e.prototype, "tipsTitleLabel", void 0),
            s([p(cc.Node)], e.prototype, "textsNode", void 0),
            s([p(cc.Label)], e.prototype, "timeLabel", void 0),
            s([p(cc.Label)], e.prototype, "areaCountLabel", void 0),
            s([p(cc.Node)], e.prototype, "btnsNode", void 0),
            s([p(cc.Node)], e.prototype, "textBgNode", void 0),
            s([d], e)
        );
    })(r.default);
o.default = h;
